package com.coollang.smartbra.presenter;

import com.coollang.smartbra.activity.ActionActivity;
import com.coollang.smartbra.bleutil.BleUtil;
import com.coollang.smartbra.model.ActionDataModel;
import com.coollang.smartbra.model.BaseModel;
import com.coollang.smartbra.model.UserGoalAndStrengthModel;

import java.util.Map;

/**
 * @Auther: Timmy
 * @Data: 2017/7/12
 * @Fuction:
 */

public class ActionActivityPresenter extends BasePresenter<BaseModel> {

    private ActionActivity mActionActivity;

    public ActionActivityPresenter(ActionActivity actionActivity) {
        super(BaseModel.class);
        mActionActivity = actionActivity;
    }

    @Override
    public void setRequestInfo() {

    }

    @Override
    protected Map<String, String> getData() {
        return null;
    }

    @Override
    protected void parsrData(BaseModel baseModel) {

    }


    // 添加计数运动数据到数据库中
    public void saveNumberActionData(ActionDataModel model) {
        mRealm.beginTransaction();
        mRealm.copyToRealm(model);
        mRealm.commitTransaction();
    }

    // 查询用户强度信息
    public void getUserStrength() {
        UserGoalAndStrengthModel first = mRealm.where(UserGoalAndStrengthModel.class).findFirst();
        int strength = first.getStrength();
        BleUtil.getInstance().sendData((byte) 0x09, (byte) strength);
    }
}
